define(function (require, exports, module) {
    var $ = require('jquery');


    var angular = require('angular');

    require('./auto_reply_service');


    var autoReply = angular.module('autoReply', ['ngRoute','ngMessages','directives.sendTab','autoReplyService','services.dialog']);
    autoReply.config(function ($routeProvider) {
        $routeProvider
            .when('/auto-reply', {
                controller: 'autoReplyCtl',
                templateUrl: "business_modules/auto_reply/ngviews/auto_reply.html"
            })
            .when('/auto-reply/word', {
                controller: 'autoReplyWordCtl',
                templateUrl: "business_modules/auto_reply/ngviews/auto_reply_keyword.html"
            })
            .otherwise({
                redirectTo: '/index'
            });
    });
    autoReply.controller('autoReplyCtl',['$scope','addAutoReply',
        function($scope,addAutoReply){

        $scope.autoReply = addAutoReply;

        addAutoReply.scope = $scope;

        $scope.$on('giveTabData',function(event,data){
            $scope.autoReply.postMsg(data);
        })

        $scope.$on('tabLinkEnd',function(event,data){
            addAutoReply.sendTabInit();
        })


        $scope.autoReply.changReplyType($scope.autoReply.replyType);
    }]);
})